import { http } from "../http";
import { ApiResponse } from "./types";

// 用户相关接口
export interface UserInfo {
  id: string;
  username: string;
  avatar: string;
  // ... 其他用户信息字段
}

export const userApi = {
  // 获取用户信息
  getUserInfo(): Promise<ApiResponse<UserInfo>> {
    return http.get("/user/info");
  },

  // 更新用户信息
  updateUserInfo(data: Partial<UserInfo>): Promise<ApiResponse<UserInfo>> {
    return http.put("/user/info", data);
  },

  // 用户登录
  login(data: {
    username: string;
    password: string;
  }): Promise<ApiResponse<{ token: string }>> {
    return http.post("/user/login", data);
  },
};
